#ifndef REMINDERDIALOG_H
#define REMINDERDIALOG_H

#include <QDialog>
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QTimer>

#ifdef Q_OS_WIN
#include <windows.h>
#endif

namespace Ui {
class ReminderDialog;
}

class ReminderDialog : public QDialog
{
    Q_OBJECT

public:
    explicit ReminderDialog(const QString &message, int countdownSeconds = 10, QWidget *parent = nullptr);
    ~ReminderDialog();
    
    static void setPassword(const QString &password); // 设置密码
    static QString getPassword(); // 获取密码
protected:
    void keyPressEvent(QKeyEvent *event) override; // 处理按键事件

private slots:
    void closeDialog();
    void validatePassword(); // 验证密码
    void updateCountdown(); // 更新倒计时

private:
    void setupUI(const QString &message);
    void startCountdown(int seconds); // 开始倒计时
    QLabel *m_messageLabel;
    QPushButton *m_closeButton;
    QLineEdit *m_passwordEdit;
    QLabel *m_passwordLabel;
    QLabel *m_countdownLabel; // 倒计时标签
    QTimer *m_countdownTimer; // 倒计时定时器
    int m_remainingSeconds; // 剩余秒数
    
    static QString s_password; // 静态密码变量
private:
    Ui::ReminderDialog *ui;
};

#endif // REMINDERDIALOG_H
